#include <led.H>

void led_disp(unsigned char adder,enable)
{
 static unsigned char teim = 0x00;
static unsigned char teim_old = 0xFF;
	
	if(enable)	
	teim |= 0x01 << adder;
	else 
	teim &= ~(0x01 << adder);
	if(teim != teim_old)
	{
	P0 = ~teim;
	P2 = P2 & 0X1F | 0X80;
	P2 &= 0X1F ;
	teim_old=teim;
	}

}
void beep(unsigned char flag)
{
	static unsigned char temp = 0x00;
	static  unsigned char temp_old = 0xFF;
	
	if(flag)	
		temp |= 0x40;
	else 
		temp &= ~0x40;
	if(temp != temp_old)
	{
		P0 = temp;
		P2 = P2 & 0X1f | 0Xa0;
		P2 &= 0X1f ;
		temp_old = temp;
	}

}
void relay (unsigned char flag)
{
static unsigned char teim = 0x00;
static unsigned char teim_old = 0xFF;
	
	if(flag)	
	teim |= 0x10 ;
	else 
	teim &= ~0x10 ;
	if(teim != teim_old)
	{
	P0 = teim;
	P2 = P2 & 0X1F | 0Xa0;
	P2 &= 0X1F ;
	teim_old=teim;
	}

}